<div class="span12">
    <div class="box gradient">
        <div class="title">
            <h4>
                <span>Information</span>
            </h4>
        </div>
        <div class="content noPad clearfix">
            <table style="width: 100%">
                <tbody>
                    <tr>
                        <td style="width: 15%">
                            <label>Date:</label>
                            <span> {{bon_livraison.date|date('d/m/Y')}}</span>
                        </td>
                        <td style="width: 15%">
                            <label>Heure:</label>
                            <span> {{bon_livraison.getTime}}</span>
                        </td>
                        <td style="width: 15%">
                            <label>Fournisseur:</label>
                            <span>{{bon_livraison.fournisseur}}</span>
                        </td>
                        <td style="width: 15%">
                            <label>Reference:</label>
                            <span>{{bon_livraison.reference}}</span>
                        </td>
                        <td style="width: 15%">
                            <label>Bon Commande:</label>
                            <span>{{bon_livraison.bonCommande}}</span>
                        </td>
                        <td style="width: 40%">
                            <label>Facture:</label>
                            <span>{{bon_livraison.facture}}</span>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div> 
    </div>
</div>
<div class="span12"  style="margin-left:0">
    <div class="box">

        <div class="title">

            <h4>
                <span class="icon16 brocco-icon-grid"></span>
            </h4>
            <a style="display: block;" href="#" class="minimize">Minimize</a>
        </div>
        <div style="display: block;" class="content noPad">
            <table class="responsive table table-bordered">
                <thead>
                    <tr>
                        <th style="width:3%">N°</th>
                        <th style="width:15%">Reference</th>
                        <th style="width:30%">Designation</th>
                        <th style="width:7%">Qte</th>
                        <th style="width:10%">P.U.HT</th>
                        <th style="width:5%">TVA</th>
                        <th style="width:5%">Remise</th>
                        <th style="width:10%">P.U.TTC</th>
                        <th>Total</th>
                    </tr>
                </thead>
                <tbody>
                    {% set total_ttc = 0 %}
                    {% for i,ligne in lignes %}
                        <tr>
                            <td>{{i+1}}</td>
                            <td>{{ligne.article.reference}}</td>
                            <td>{{ligne.article.designation}}</td>
                            <td>{{ligne.quantite|number_format(2)}}</td>
                            <td>{{ligne.prixUnitaireHt}}</td>
                            <td>{{ligne.tauxTva|number_format(2)}}%</td>
                            <td>{{ligne.tauxRemise|number_format(2)}}</td>
                            {% set ttc = ligne.prixUnitaireHt*(1+ligne.tauxTva/100)*(1-ligne.tauxRemise/100) %}
                            <td>{{ttc|number_format(3)}}</td>
                            {% set total = ttc*ligne.quantite %}
                            {% set total_ttc = total+total_ttc %}
                            <td>{{total|number_format(3)}}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
        <div class="span2" style="margin-left:83%">
            <div class="content noPad clearfix">
                <table class="responsive display table table-bordered" width="100%" cellspacing="0" cellpadding="0" border="1px" style="border:#D0E9F5 ">
                    <thead>
                        <tr>
                            <th class="center" style="text-align: center">TOTAL TTC</th>
                            <th id="total_ttc" class="center">{{total_ttc|number_format(3)}}</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
    <div class="span2" style="margin-left:0">
        <div class="box gradient">
            <div class="content noPad clearfix">
                <table class="responsive display table table-bordered" width="100%" cellspacing="0" cellpadding="0" border="0">
                    <thead>
                        <tr>
                            <th>Taxe</th>
                            <th>Base</th>
                            <th>Montant</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% set totaux = 0 %}
                        {% for taxe in taxes %}
                            <tr>
                                <td>{{taxe.tva|number_format(2)}}%</td>
                                <td>{{taxe.base|number_format(3)}}</td>
                                {% set totaux = totaux + taxe.montant %}
                                <td>{{taxe.montant|number_format(3)}}</td>
                            </tr>
                        {% endfor %}
                            <tr>
                                <td>Totaux</td>
                                <td></td>
                                <td>{{totaux|number_format(3)}}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
<div class="span2" style="margin-right: 0">
    <table>
        <tr>
            <td><input style="width:100px" type="button" class="btn btn-info cut-icon-previous"  value="Retour" onclick="retourListeBonLivraison()"></td>
        </tr>
        <tr>
            <td style="height: 20px"></td>
        </tr>
        <tr>
            <td><input style="width: 100px" type="button" class="btn btn-info cut-icon-previous"  value="Imprimer" onclick=""></td>
        </tr>
    </table>
</div>

<script>
    function retourListeBonLivraison(){
        $.ajax({
        url: "{{ path('gds_achat_liste_bon_livraison') }}",
            data: 'retour=true'+'&numero='+lf[0]+'&client='+lf[1]+'&date1='+lf[2]+'&date2='+lf[3]+'&heure1='+lf[4]+'&heure2='+lf[5]
                    +'&reference='+lf[6]+'&designation='+lf[7]+'&ttc1='+lf[8]+'&ttc2='+lf[9]+'&is_cloture='+lf[10]
                    + '&reglement='+lf[11]+ '&departement='+lf[12],
            success: function(data) {
                $('#div_liste_bon_livraison').replaceWith(data)
                $('#filtre_numero').val(lf[0])
                $('#client').val(lf[1])
                $('#filtre_date1').val(lf[2])
                $('#filtre_date2').val(lf[3])
                $('#filtre_reference').val(lf[6])
                $('#filtre_designation').val(lf[7])
                $('#filtre_ttc1').val(lf[8])
                $('#filtre_ttc2').val(lf[9])
                $('#filtre_type').val(lf[10])
                $('#filtre_reglement').val(lf[11])
                $('#departement').val(lf[12])
            }
        })
    }
</script>